feat: Add ContractLog data model and repository interface#75
feat: Add ContractLog data model and repository interface#75Twiineenock wants to merge 1 commit intohiero-ledger:mainfrom
Conversation
This commit introduces the core data model (ContractLog) and the ContractLogRepository interface to support querying smart contract events from the Hiero Mirror Node. This establishes the public API surface for the feature, and is aligned strictly with the Hedera Mirror Node REST API JSON responses. Signed-off-by: Twiineenock <Twiineenock@users.noreply.github.com>
2cd3014 to
51023e9
Compare
There was a problem hiding this comment.
Should ContractLog align more closely with the existing ContractResult DTO? Both model Mirror Node contract endpoints, and ContractResult keeps EVM/Mirror metadata fields like contractId, blockHash, blockNumber, and transactionIndex nullable/boxed while using the Mirror field name timestamp. Matching that shape here would make the contract DTOs more consistent and avoid requiring fields that Mirror responses may omit or return as null.
There was a problem hiding this comment.
I think this should probably be part of ContractRepository rather than a separate ContractLogRepository. Existing repository APIs appear to group Mirror Node reads around the parent domain object, for example TopicRepository owns both topic lookup and topic messages. Since these logs are contract-scoped and queried by ContractId, exposing them alongside the other contract reads would make the API more consistent.
|
I had similar work in progress before this PR (contract results/logs + Spring/MicroProfile wiring + converters/tests). Happy to wait for this to merge and then contribute my implementation as a follow-up PR. |
Description
This PR addresses the first phase of the proposed solution in the linked issue by establishing the core data model and repository interface for the Smart Contract Event and Log API.
To ensure the review process is clean and manageable for mentors, the implementation is being split into logical PRs. This PR specifically focuses on the public API surface:
ContractLogrecord, meticulously mapped to the EVM event log format returned by the Hiero Mirror Node (handling fields liketopics,data, and mappingconsensus_timestampto Java'sInstant).ContractLogRepositoryinterface to provide a high-level abstraction for querying logs byContractId.Subsequent PRs will introduce the
basemodule implementations, followed by the framework-native (Spring Boot/MicroProfile) JSON parsers and pagination handlers.Related issue(s)
Fixes #74
NB
topicslist is wrapped inList.copyOf()) and strict null-safety usingorg.jspecify.annotations.